﻿@{
    ViewBag.Title = "提现管理";
    Layout = "~/Views/Shared/_Index.cshtml";
}
<script src="~/Content/js/datepicker/WdatePicker.js"></script>
<script>
    var type = -2;
    $(function () {
        gridList(-2);
        $('#ulOrder a').click(function (e) {
            type = $(this).attr("type");
            $("#btn_search").click();
        });

    });

    function gridList(t) {
        type = t;
        var $gridList = $("#gridList");

        var postData = {
            Type: type,
            UserType: $("#txt_UserType").val(),
            WithdrawalsTimeStart: $("#txt_startDate").val(),
            WithdrawalsTimeEnd: $("#txt_endDate").val(),
        };
        $gridList.dataGrid({
            url: "/BizManage/WithdrawalsManage/GetListForWithdrawals",
            postData: postData,
            height: $(window).height() - 158,
            colModel: [
                { label: '提现流水号', name: 'F_SerialNumber', width: 150, align: 'center', sortable: false },
                { label: '申请人账号', name: 'UserName', width: 150, align: 'center' ,sortable:false},
                { label: '申请人姓名', name: 'RealName', width: 150, align: 'center', sortable: false },
                { label: '申请人联系方式', name: 'CellPhone', width: 150, align: 'center', sortable: false },



                {
                    label: '申请提现金额(元)', name: 'F_WithdrawalsMoney', width: 100, align: 'center', sortable: false,
                    formatter: function (cellvalue, options, rowObject) {
                        return cellvalue == null ? "" : parseFloat(cellvalue).toFixed(2);
                    }
                },
                { label: '申请人开户行', name: 'OpeningBank', width: 150, align: 'center', sortable: false },
                { label: '开户人', name: 'AccountName', width: 150, align: 'center', sortable: false },
                { label: '银行卡号', name: 'Account', width: 150, align: 'center', sortable: false },
                { label: '申请时间', name: 'F_WithdrawalsTime', width: 150, align: 'center', sortable: false },
                {
                    label: '处理状态', name: 'F_WithdrawalsStatus', width: 100, align: 'center', sortable: false,
                    formatter: function (cellvalue) {
                        switch (cellvalue) {
                            case 0: return "未打款"; break;
                            case 1: return "已打款"; break;
                        }
                    }
                },
                {
                    label: '订单操作', name: '', width: 100, align: 'left',sortable:false,
                    formatter: function (cellvalue, options, rowObject) {
                        var str = "";
                        if (rowObject.F_WithdrawalsStatus == 0) {
                            str += " <a href='#' onclick='javascript:btn_tx(\"" + rowObject.F_Id + "\")' style='text-decoration:underline;color:blue'>打款</a>";
                        }
                        return str;
                    }
                }
            ],
            pager: "#gridPager",
            sortname: 'F_WithdrawalsTime desc',
            viewrecords: true
        });

        $("#btn_search").click(function () {
            var postData = {
                Type: type,
                UserType: $("#txt_UserType").val(),
                WithdrawalsTimeStart: $("#txt_startDate").val(),
                WithdrawalsTimeEnd: $("#txt_endDate").val(),
            };
            $gridList.jqGrid('setGridParam', {
                postData: postData
            }).trigger('reloadGrid');
        });
    }
    
    //确认体现申请
    function btn_tx(Id) {
        $.submitForm({
            url: "/BizManage/WithdrawalsManage/DoWithdrawals",
            param: { Id: Id },
            success: function() {
                $.currentWindow().$("#gridList").trigger("reloadGrid");
            }
        });
    }

   
</script>
<div class="topPanel">
    <div class="search">
        <table>
            <tr>
                <td>
                    <div class="input-group">

                        <input id="txt_startDate" type="text" class="form-control input-wdatepicker" onfocus="WdatePicker()" placeholder="申请日期" style="width: 150px;" />
                        --
                        <span style="float:right;margin-left:3px;"> <input id="txt_endDate" type="text" class="form-control input-wdatepicker" onfocus="WdatePicker()" placeholder="申请日期" style="width: 150px;" /></span>
                        <span class="input-group-btn">
                            <button id="btn_search" type="button" class="btn  btn-primary" title="搜索"><i class="fa fa-search"></i></button>
                        </span>
                    </div>
                </td>
            </tr>
        </table>
    </div>
    <div class="toolbar">
        <div class="btn-group">
            <a class="btn btn-primary" onclick="$.reload()"><span class="glyphicon glyphicon-refresh"></span></a>
        </div>
    </div>
</div>
<div class="tab-content content">
    <ul class="nav nav-tabs" role="tablist" id="ulOrder">
        <li role="presentation" class="active"><a href="#home" type="-2" id="ahome" aria-controls="home" role="tab" data-toggle="tab">全部提现记录</a></li>
        <li role="presentation"><a href="#home" type="0" aria-controls="profile" role="tab" data-toggle="tab">待处理</a></li>
        <li role="presentation"><a href="#home" type="1" aria-controls="profile" role="tab" data-toggle="tab">已完成</a></li>
    </ul>
    <div role="tabpanel" class="tab-pane active " id="home">
        <div class="gridPanel" id="baseInfo" class="tab-pane fade in active">
            <table id="gridList"></table>
            <div id="gridPager"></div>
        </div>
    </div>
</div>
